package fr.znight.chacunsatv.utils;

import java.util.Comparator;

import android.content.Context;
import android.graphics.drawable.Drawable;

public class AppObject {

	protected String AppName;
	protected String PackageName;
	protected Drawable Icon;
	
	public boolean equals(Object o) {
		if (this.PackageName.equals(((AppObject)o).PackageName))
			return true;
		else
			return false;
	}

	public static Comparator<AppObject> AppObjectComparator = new Comparator<AppObject>() {

		public int compare(AppObject obj1, AppObject obj2) {

			//ascending order
			return obj1.AppName.compareTo(obj2.AppName);
 
			//descending order
			//return obj2.AppName.compareTo(obj1.AppName);
		}

	};
	

	public void setAppName(String appName) {
		AppName = appName;
	}

	public void setPackageName(String packageName) {
		PackageName = packageName;
	}

	public void setIcon(Drawable icon) {
		Icon = icon;
	}

	public String getAppName() {
		return AppName;
	}

	public String getPackageName() {
		return PackageName;
	}

	public Drawable getIcon() {
		return Icon;
	}

	public Drawable getIcon(Context context) {
		return this.Icon;
	}

	public String getLabel() {
		return this.AppName;
	}

}
